<?php
/**
 * 外部模板数据资源
 *
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/13 0013
 * Time: 14:55
 */
namespace app\api\model\outer;

use app\common\helper\Obj2Array;
use think\Model;

class SkinModel extends Model{
    protected $table = 'album_skin';
    protected $connection = 'applet_album_config';

    public static function getAll() {
        $model = new self();
        $list = $model->alias('s')
            ->field(['c.id' => 'cate_id', 'c.title' => 'cate_name', 's.skintitle' => 'title', 's.skiname' => 'name', 's.music', 's.ishot' => 'is_hot', 's.remoted' => 'is_remote'])
            ->join('album_skincate c', 's.cid = c.id', 'left')
            ->select();

        $data = [];
        foreach ($list as $key => $item) {
            $data[] = $item->getData();
        }
        return $data;
    }
}